package hotairballoon.gui;

/***
 * Main class.
 * @author malpka
 *
 */
import hotairballoon.gui.internalframe.InternalFrameContainer;
import hotairballoon.shape.classic.FreeHandClassicShapeConstructor;

import java.awt.Dimension;
import java.awt.Toolkit;

import javax.swing.JDesktopPane;
import javax.swing.JFrame;
import javax.swing.UIManager;


public class HotAirBalloon extends JFrame {

	private static final long serialVersionUID = 1L;
	
	JDesktopPane desktop;
    
	public HotAirBalloon() {
        super("HotAirBalloon");

        //Make the big window be indented 50 pixels from each edge
        //of the screen.
        int inset = 50;
        Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
        setBounds(inset, inset,
                  screenSize.width  - inset*2,
                  screenSize.height - inset*2);

        //Set up the GUI.
        desktop = new JDesktopPane();
        createFrames();
        setContentPane(desktop);
    }

    //Create a new internal frame.
    protected void createFrames() {
 
        /* test */
        FreeHandClassicShapeConstructor test = new FreeHandClassicShapeConstructor();
    	InternalFrameContainer testFrame = new InternalFrameContainer("GraphTest", test);
    	testFrame.setVisible(true);
        desktop.add(testFrame);
        
        try {
        	testFrame.setSelected(true);
        } catch (java.beans.PropertyVetoException e) {}
    }

    private static void createAndShowGUI() {
        //Create and set up the window.
        HotAirBalloon frame = new HotAirBalloon();
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

        frame.setVisible(true);
    }

    public static void main(String[] args) {
    	
    	try {
    		UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
	    } catch (Exception e) {
	    	e.printStackTrace();
	    }
    	    
        //Schedule a job for the event-dispatching thread:
        //creating and showing this application's GUI.
        javax.swing.SwingUtilities.invokeLater(new Runnable() {
            public void run() {
                createAndShowGUI();
            }
        });
    }

}
